package java.wxw;

import java.util.Scanner;
/**
 * @author songzihan
 * @create 2020--07--03
 */
public class Read extends  Final {
    FileExist fileExist = new FileExist();
    FindPANo findPANo = new FindPANo();
    DirExist dirExist = new DirExist();
    int n=0;
    String fileName;
    public void ReadFile(){
        if(dirName.toUpperCase().equals(userName.toUpperCase())){
            System.out.println("Please convert to ufd dir before read");
            return;
        }
        System.out.println("Caution:Open file first");
        System.out.println("Opened File(s) List");
        int k = dirExist.dirExist(dirName);
        for (int i=0;i<userDirCount;i++){
            if(openIf[k][i].openIf==1){
               if (openIf[k][i].openMode==0||openIf[k][i].openMode==2){
                   System.out.println(userDirs);
                   n++;
               }
            }
            if (n==0){
                return;
            }
            if (n!=0){
                System.out.println("Please input FileName:");
                Scanner in = new Scanner(System.in);
                if (in.hasNext()){
                    fileName =  in.next();
                }
                int j = dirExist.dirExist(fileName);
                if (j>=0){
                    if (openIf[k][i].openMode==0||openIf[k][i].openMode==2){
                        //此处读取代码
                    }else {
                        System.out.println("File   has been opened with WRITE ONLY mode");
                    }
                }else {
                    System.out.println(" File is in closing status. Please open it before read");
                }

            }else {
                System.out.println("File  does not exist.");
            }
        }

    }
}
